<html lang="in-ID" prefix="og: http://ogp.me/ns#" xmlns:fb="http://ogp.me/ns/fb#">
    <head>
        <title><?php echo ($pageTitle != "" ? ($pageTitle . " :: Perdesaan Sehat") : "Perdesaan Sehat"); ?></title>
        <meta name="description" content="<?php echo str_replace("\"", "'", $descFB); ?>" />
        <meta name="keywords" content="<?php echo $keywords; ?>" />
        <meta property="fb:app_id" content="<?php echo $facebook->getAppId(); ?>" />
        <meta property="og:type" content="<?php echo $isArticle ? "article" : "website"; ?>" />
        <meta property="og:title" content="<?php echo str_replace("\"", "'", ($titleFB != "" ? $titleFB : ($pageTitle ? ($pageTitle . " :: Perdesaan Sehat") : "Perdesaan Sehat"))); ?>" />
        <meta property="og:site_name" content="Homepage Perdesaan Sehat" />
        <meta property="og:url" content="<?php echo current_url(); ?>" />
        <meta property="og:image" content="<?php echo $imageFB; ?>" />
        <meta property="og:description" content="<?php echo str_replace("\"", "'", $descFB); ?>" />

        <link rel="stylesheet" type="text/css" href="<?php echo res_url("css/base.css"); ?>" />
        <link rel="stylesheet" type="text/css" href="<?php echo res_url("css/jqui/jquery-ui-1.10.4.custom.css"); ?>" />
        <script src="<?php echo res_url("js/lib/jquery-1.11.0.min.js"); ?>"></script>
    </head>
    <body>
        <div class="page">
            <div class="header">
                <?php $this->view("layout/header", array("menuHL" => $menuHL, "loggedUser" => $loggedUser)); ?>
            </div>
            <div class="content">
                <?php echo $breadcrumb; ?>
                <div class="content-container">
                    <?php echo $content; ?>
                </div>
            </div>
            <div class="footer">
                <?php $this->view("layout/footer", array("menuHL" => $menuHL)); ?>
            </div>
        </div>
        <!-- ETC -->
        <div id="fb-root"></div>
        <script src="<?php echo res_url("js/lib/jquery-ui-1.10.4.custom.min.js"); ?>"></script>
        <script src="<?php echo res_url("js/lib/datepicker-id.min.js"); ?>"></script>
        <script src="<?php echo res_url("js/lib/jquery.form.min.js"); ?>"></script>
        <script src="<?php echo res_url("js/ps.js"); ?>"></script>
        <script src="<?php echo res_url("js/ps-image-uploader.js"); ?>"></script>
        <?php if ($useEditor) { ?>
            <script src="<?php echo res_url("js/lib/tinymce/tinymce.min.js"); ?>"></script>
            <script src="<?php echo res_url("js/ps-tinymce.js"); ?>"></script>
        <?php } ?>
        <?php if ($useSlideShow) { ?>
            <script src="<?php echo res_url("js/lib/jssor/jssor.core.min.js"); ?>"></script>
            <script src="<?php echo res_url("js/lib/jssor/jssor.utils.min.js"); ?>"></script>
            <script src="<?php echo res_url("js/lib/jssor/jssor.slider.min.js"); ?>"></script>
        <?php } ?>
        <?php if ($useDocViewer) { ?>            
            <script src="<?php echo res_url("js/lib/jquery.gdocsviewer.min.js"); ?>"></script>
        <? } ?>
        <?php if ($useMap) { ?>
            <script src="<?php echo res_url("js/lib/OpenLayers-2.13.1/OpenLayers.js", false) ?>"></script>
            <script src="<?php echo res_url("js/ps-map-explorer.js") ?>"></script>
            <script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script>
        <?php } ?>
        <script type="text/javascript">
            // log
            console.log("<?php echo $elapsedTime; ?>");
            // FB
            (function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id))
                    return;
                js = d.createElement(s);
                js.id = id;
                js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=<?php echo $facebook->getAppId(); ?>";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
            // userJSON
            var loggedUser = <?php echo (!is_null($loggedUser) ? json_encode($loggedUser) : "null"); ?>;
            // jQueryUI
            $(function() {
                // buttons
                $("input[type=submit], button, input[type=button]")
                        .button();
                // datepickers
                $(".datepicker").datepicker({
                    dateFormat: "yy-mm-dd"
                }).each(function() {
                    $(this).prop("readonly", true);
                    $(this).hover(function() {
                        $(this).css("cursor", "pointer");
                    });
                });
                $.datepicker.setDefaults($.datepicker.regional["id"]);
            });
            // alert
            (function() {
                var proxied = window.alert;
                window.alert = function() {
                    // do something here
                };
                window.alert = function(text, title) {
                    if (title) {
                        $("<div title='" + title + "'>" + text + "</div>").dialog(
                                {modal: true,
                                    autoOpen: false,
                                    buttons: {
                                        Ok: function() {
                                            $(this).dialog("close");
                                        }
                                    }, close: function() {
                                        $(this).dialog('destroy').remove();
                                    }
                                }
                        ).dialog("open");
                        return false;
                    } else {
                        return proxied.apply(this, arguments);
                    }
                };
            })();
            function doFBShare(link, caption) {
                FB.ui({
                    method: 'feed',
                    link: link,
                    caption: caption
                }, function(response) {
                });
            }
        </script>
    </body>
</html>